package putYourHands.controllers;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import putYourHands.services.PacienteService;

public class PacientesController implements Controller {
	
	private PacienteService pacienteService;

	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("stdout - Returning pacientes");

		Map<String, Object> myModel = new HashMap<String, Object>();
		myModel.put("pacientes", this.pacienteService.getPacientes());
		
		return new ModelAndView("pacientes", "model", myModel);
	}
	
	public void setPacienteService(PacienteService service){
		this.pacienteService=service;
	}
}
